# bzip2.cmake
# 本文件包含着从外部导入 bzip2 所需要的信息

INCLUDE(ExternalProject)

set(BZIP2_ROOT ${PROJECT_SOURCE_DIR}/extern_module_download/bzip2)
set(BZIP2_GIT_URL      https://atomgit.com/dangaldb/bzip2.git)  # 指定git仓库地址
set(BZIP2_CONFIGURE    cd ${BZIP2_ROOT}/src/extern_bzip2)
set(BZIP2_MAKE         cd ${BZIP2_ROOT}/src/extern_bzip2 && make)
set(BZIP2_INSTALL      cd ${BZIP2_ROOT}/src/extern_bzip2 && make install PREFIX=${BZIP2_ROOT}/output) 

ExternalProject_Add(extern_bzip2
        PREFIX            ${BZIP2_ROOT}
        GIT_REPOSITORY    ${BZIP2_GIT_URL}
        CONFIGURE_COMMAND ${BZIP2_CONFIGURE}
        BUILD_COMMAND     ${BZIP2_MAKE}
        INSTALL_COMMAND   ${BZIP2_INSTALL}
)

INCLUDE_DIRECTORIES(${BZIP2_ROOT}/output/include)
LINK_DIRECTORIES(${BZIP2_ROOT}/output/lib)